﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject.MetaDataList
{
    public class ListSalesmenAddressArea : NotifyPropertyChangeObject
    {
        private int addessAreaID;

        private string description;        
        private string other;

        private bool inActive;


        public ListSalesmenAddressArea()
            : this(-1, "", "", false)
        {
        }

        public ListSalesmenAddressArea(int addessAreaID, string description, string other, bool inActive)
        {
            GlobalDefaultValue.Apply(this);

            this.AddressAreaID = addessAreaID;
            this.Description = description;
            this.Other = other;
            this.InActive = inActive;
            
        }


        #region Properties

        [DefaultValue(-1)]
        public int AddressAreaID
        {
            get { return this.addessAreaID; }
            set { ApplyPropertyChange<ListSalesmenAddressArea, int>(ref this.addessAreaID, o => o.AddressAreaID, value); }
        }


        [DefaultValue("")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<ListSalesmenAddressArea, string>(ref this.description, o => o.Description, value); }
        }


        [DefaultValue("")]
        public string Other
        {
            get { return this.other; }
            set { ApplyPropertyChange<ListSalesmenAddressArea, string>(ref this.other, o => o.Other, value); }
        }

        [DefaultValue(false)]
        public bool InActive
        {
            get { return this.inActive; }
            set { ApplyPropertyChange<ListSalesmenAddressArea, bool>(ref this.inActive, o => o.InActive, value); }
        }

        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("AddessAreaID", "Please fill a common ID.", delegate { return (this.AddressAreaID > 0); }));

            return validationRules;
        }
    }
}
